// index.js
// 获取应用实例
const app = getApp()
import customerApi from '../../api/customer'

Page({
  data: {
    list:[]
  },
  onShow() {
    this.getList()
  },
  onLoad() {
    this.getList()
     //初始化验证参数
    //  this.initValidate()
  },
  getList() {
    customerApi.customerListEmp().then((res)=>{
      let data = res
      this.setData({
        list:data
      })
      console.log("data----xx---->",data)
    })
  },
  submitBtn(e) {
    console.log("---submitBtn-->")
    // if (!this.wxValidate.checkForm(e.detail.value)) {
    //   const error = this.wxValidate.errorList[0]
    //   wx.showToast({
    //     title: error.msg,
    //     icon: "none",
    //     duration: 800
    //   })
    //   return false
    // }
  },
  addEmployee() {
    wx.navigateTo({
      url: '../employee/employee'
    })
  },
  onCellBtn(e) {
    let dataset = e.currentTarget.dataset.item
    wx.navigateTo({
      url: '../employee/employee?id=' + dataset.id + `&name=${dataset.name}&phone=${dataset.phone}`
    })
  }

})
